package com.yang.controller;

import com.yang.constants.SystemConstants;
import com.yang.domain.Result;
import com.yang.domain.entity.Comment;
import com.yang.service.CommentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@RequestMapping("comment")
@RestController
public class CommentController {

    @Resource
    private CommentService commentService;

    @GetMapping("/commentList")
    public Result commentList(Long articleId, Integer pageNum, Integer pageSize){
        return commentService.commentList(SystemConstants.ARTICLE_COMMENT,articleId,pageNum,pageSize);
    }


    @PostMapping
    public Result addComment(@RequestBody Comment comment){
        return commentService.addComment(comment);
    }


    @GetMapping("/linkCommentList")
    public Result linkCommentList(Integer pageNum,Integer pageSize){
        return commentService.commentList(SystemConstants.LINK_COMMENT,null,pageNum,pageSize);
    }

}
